package com.example.demo1.user.view.application;

import com.example.demo1.user.entity.DrawGridPane;
import com.example.demo1.user.entity.Painter;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;

import java.io.FileNotFoundException;

/**
 * 制作游戏界面的操作
 */
public class AdventureModeApplication extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage stage) throws FileNotFoundException {
        AnchorPane anchorPane = new AnchorPane();
        // 绘制画布
        Canvas canvas = new Canvas(800, 600);  // 确定画布的大小
        Painter painter = new Painter(canvas);
        painter.paintBackground(canvas);

        DrawGridPane drawGridPane = new DrawGridPane();
        anchorPane.getChildren().addAll(canvas, drawGridPane.drawGrid());

        Scene scene = new Scene(anchorPane);
        stage.setScene(scene);
        stage.setTitle("植物大战僵尸");
        stage.show();
    }
}
